<style>
#modifypwd_form{
		padding: 15px;
		margin-left: 15px;
		margin-right: 15px;
		margin-top: 5px;
		margin-bottom: 5px;
	}

	
#modifypwd_form input{
	border: 1px solid #46A3FF;
	height: 30px;
	margin-top:2px;
}
#modifypwd_form label{
	margin-top:2px;
}

.btn{
	border: 1px solid #3580A9;
	text-shadow: 0px -1px 0px #2C6AA3;
	font-weight: bold;
	font-size:15px;
	padding: 5px 10px;
	border-radius: 3px 3px 3px 3px;
	box-shadow: 0px 1px 5px #B2B2B2;"
}
</style>

<form id="modifypwd_form" action="" method="post">
	<table id="modifypwd_tb">
		<tr>
			<td><label>旧密码：&nbsp;&nbsp;</label></td>
			<td>
				<input type="password" name="oldpwd" value="" size="50"  maxlength="10">
			</td>
		</tr>
		<tr>
			<td><label>新密码：</label></td>
			<td>
				<input type="password" name="newpwd" value="" size="50"  maxlength="10">
			</td>
		</tr>
		
		<tr>
			<td><label>新密码：</label></td>
			<td>
				<input type="password" name="repeatpwd" value="" size="50"  maxlength="10">
				<input type="hidden" id="id8" value="{{accountType}}">
			</td>
		</tr>
		<tr><td></td>
		<td><input class="btn" style="margin-top:10px;" type="button" value="确定" onclick="submit_modify();">&nbsp;&nbsp;<input type="reset" value="重置" class="btn"></td></tr>
	</table>
</form>

<script>
	function submit_modify(){
	  
	    if( $("#id8").val() == 0){
	            var re = /\d{1}|\d{2}|\d{3}|\d{4}|\d{5}|\d{6}|\d{7}|\d{8}|\d{9}|\d{10}/;	       
	            var newpwd = $("#modifypwd_tb input[name='newpwd']").val();
	            if(!re.test(newpwd)){
		             $.jBox.tip('您的密码只能为数字且最多为10位', 'error');
		             return false;
	             }
	           
	      }       
		var oldpwd = $("#modifypwd_tb input[name='oldpwd']").val()
		var newpwd = $("#modifypwd_tb input[name='newpwd']").val()
		var repeatpwd = $("#modifypwd_tb input[name='repeatpwd']").val()
		
		if(newpwd != repeatpwd){
			$.jBox.tip("新密码两次输入不一致","error");
			return;
		}
		else{
		
		$.ajax({
            type: 'POST',
            url: '/lottery/settings/modifypwd/submit_modify',
            data: $('#modifypwd_form').serialize(),
            success:function(data){
            	//$.jBox.tip('密码修改成功', 'success');
            	alert("密码修改成功,请重新登录")            	
            	var tab = $('#tabs').tabs('getSelected');
                $("#tabs").tabs("close", tab.panel('options').tab.text());
                location.reload('login.html');
            },
            error:function (req, status, error){
            	$.jBox.tip(req.responseText, 'error');
            }
        });
        }
	}
</script>